/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.converter;

import br.com.deployment.entities.Executor;
import br.com.deployment.entities.NotaryOffice;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

/**
 *
 * @author ely
 */
@FacesConverter(value = "executorConverter")
public class ExecutorConverter implements Converter {

    @Override
    public Object getAsObject(FacesContext context, UIComponent component, String value) {
        Executor executor = new Executor();
        executor.setId((Long.valueOf(value)));
        return executor;
    }

    @Override
    public String getAsString(FacesContext context, UIComponent component, Object value) {
        Executor executor = (Executor) value;
        return "" + executor.getId();
    }
}
